package com.interview.exception;

import org.springframework.stereotype.Service;


@Service
public class ExceptionK  extends Log{
	
	
	
	public class ExceptionA extends Exception {
		public ExceptionA(String string) {
			super(string);
		}
	}

	public class ExceptionB extends Exception {
		public ExceptionB(String string) {
			super(string);
		}
	}

	public class ExceptionC extends Exception {
		public ExceptionC(String string) {
			super(string);
		}
	}

	public void j() throws ExceptionA {
		throw new ExceptionA("A-Exception");
	}

	public void a() throws ExceptionB {
		try {
			j();
		} catch (ExceptionA e) {
			ExceptionB b = new ExceptionB("B-Exception");
			b.initCause(e);
			logger.error("B-Exception",e);
			throw b;
		}

	}

	public void c() throws ExceptionC {
		try {
			a();
		} catch (ExceptionB e) {
			ExceptionC c = new ExceptionC("C-Exception");
			c.initCause(e);
			logger.error("C-Exception",e);
			throw c;
		}
	}

	public static void main(String[] arges)  {
		ExceptionK k = new ExceptionK();
		try {
			 k.c();
		} catch (Exception e) {
			
			e.printStackTrace();
		}

	}
}
